/*
 * My_Pid.h
 *
 *  Created on: Feb 17, 2024
 *      Author: 86157
 */

#ifndef MY_PID_H_
#define MY_PID_H_

#include "zf_common_headfile.h"
typedef struct
{
    float kp,ki,kd;//����ϵ��
    float error,lastError,l_lastError;//���ϴ����
    float integral,maxIntegral;//���֡������޷�
    float output,maxOutput;//���������޷�
}PID;
typedef struct
{
    float kp,ki,kd,kp1;//����ϵ��
    float error,lastError,l_lastError;//���ϴ����
    float output,maxOutput;//���������޷�
}My_PID;
extern My_PID  ErrPid;
extern PID  GryozPid;
extern PID  L_SpeedPid;
extern PID  R_SpeedPid;
extern PID  Err1Pid;
void PID_Init(PID *pid,float p,float i,float d,float maxI,float maxOut);
void My_PID_Init(My_PID *pid,float p,float i,float d,float maxOut);
void PID_Calc(PID *pid,float reference,float feedback);

void PID_realize(PID *pid,float reference,float feedback);  //����ʽpid
/****************************** �ٶ� *************************************************/
int PID_Calc_L(PID *pid,float reference,float feedback);
int PID_Calc_R(PID *pid,float reference,float feedback);
/****************************** end *************************************************/
void Err_PID_Calc(PID *pid,float reference,float feedback,float GKD);
void Err_PID_Calc1(My_PID *pid,float reference,float feedback);

#endif /* MY_PID_H_ */
